package com.qingpeng.pay.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qingpeng.pay.R;
import com.qingpeng.pay.beans.CodeBean;

public class CodeAdapter extends BaseQuickAdapter<CodeBean.DataProductBean,BaseViewHolder> {
    public CodeAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, CodeBean.DataProductBean item){
        if (item.getType().equals("1")){
            helper.setText(R.id.name,item.getName())
                    .setText(R.id.money,item.getEdu()+"元")
                    .setImageResource(R.id.image,R.mipmap.ic_order_weixin)
                    .setText(R.id.text_shengyu,"当前剩余: "+item.getLimit()+"元")
                    .addOnClickListener(R.id.delete)
                    .addOnClickListener(R.id.text_fenpei)
                    .addOnClickListener(R.id.text_list)
                    .addOnClickListener(R.id.text_yipao);
        }else{
            helper.setText(R.id.name,item.getName())
                    .setText(R.id.money,item.getEdu())
                    .setImageResource(R.id.image,R.mipmap.ic_order_alipay)
                    .setText(R.id.text_shengyu,"当前剩余: "+item.getLimit()+"元")
                    .addOnClickListener(R.id.delete)
                    .addOnClickListener(R.id.text_fenpei)
                    .addOnClickListener(R.id.text_list)
                    .addOnClickListener(R.id.text_yipao);
        }
    }
}
